package cn.aopmin.mock.demo.enums;

public enum PositionEnum {
    MANAGER(1, "manager"),
    DEVELOPER(2, "developer"),
    TESTER(3, "tester"),
    DESIGNER(4, "designer"),
    OTHERS(5, "others");
    ;

    PositionEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {}
    private int type;
    private String desc;

    public static PositionEnum getPositionEnum(int type) {
        for (PositionEnum positionEnum : PositionEnum.values()) {
            if (positionEnum.getType() == type) {
                return positionEnum;
            }
        }
        return null;
    }
    public static String getPositionDesc(int type) {
        for (PositionEnum positionEnum : PositionEnum.values()) {
            if (positionEnum.getType() == type) {
                return positionEnum.getDesc();
            }
        }
        return "";
    }

    public static boolean isDeveloper(int type) {
        return type == PositionEnum.DEVELOPER.getType();
    }
}